package com.warrior.entity;

import javax.persistence.*;

/**
 * 微信缓存schema
 * Created by Shawn on 2017/4/6.
 */
@Entity
@Table(name = "wx_cache", schema = "warrior")
public class WxCache {
    private int id;
    private String jsapiTicket;
    private String accessToken;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "jsapi_ticket")
    public String getJsapiTicket() {
        return jsapiTicket;
    }

    public void setJsapiTicket(String jsapiTicket) {
        this.jsapiTicket = jsapiTicket;
    }

    @Basic
    @Column(name = "access_token")
    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        WxCache wxCache = (WxCache) o;

        if (id != wxCache.id) return false;
        if (jsapiTicket != null ? !jsapiTicket.equals(wxCache.jsapiTicket) : wxCache.jsapiTicket != null) return false;
        if (accessToken != null ? !accessToken.equals(wxCache.accessToken) : wxCache.accessToken != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (jsapiTicket != null ? jsapiTicket.hashCode() : 0);
        result = 31 * result + (accessToken != null ? accessToken.hashCode() : 0);
        return result;
    }
}
